﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Login.aspx.cs" Inherits="Admin_Login" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Untitled Page</title>

    <script type="text/javascript">
        function SignInValidate() {

            var UserName = document.getElementById('<%= Login1.FindControl("UserName").ClientID %>').value;
            var Password = document.getElementById('<%= Login1.FindControl("Password").ClientID %>').value;
            var UserNameLabel = document.getElementById('<%= Login1.FindControl("UserNameLabel").ClientID %>');
            var PasswordLabel = document.getElementById('<%= Login1.FindControl("PasswordLabel").ClientID %>');
            var Errcolor = "red";
            var mycolor = "black";
            var ErrorString = "";
            if (UserName == '') {
                UserNameLabel.style.color = Errcolor;
                ErrorString = "Error";

            }
            else
                UserNameLabel.style.color = mycolor;
            if (Password == '') {
                PasswordLabel.style.color = Errcolor;
                ErrorString = "Error";
            }
            else
                PasswordLabel.style.color = mycolor;

            if (ErrorString != "") {
                return false;
            }
            return true;

        }
    </script>

</head>
<body style="background-color:#ccc;">
    <form id="form1" runat="server">
    <br />
    <br />
    <br />
    <div style="width: 400px; margin-left: auto; margin-right: auto; font-weight:bold;">
        Admin Login:</div>
    <div style="width: 400px; margin-left: auto; margin-right: auto;">
        <asp:Login ID="Login1" runat="server" InstructionText="Please enter your user name and password for login."
            OnAuthenticate="Login1_Authenticate">
            <LayoutTemplate>
                <asp:Panel ID="DefaultButtonPanel" DefaultButton="ImageButton1" runat="server">
                    <table style="background-color:#fff; width:400px; ">
                        <tr>
                            <td>
                                <asp:Label ID="UserNameLabel" runat="server" AssociatedControlID="UserName">UserName</asp:Label>
                            </td>
                            <td>
                                <asp:TextBox ID="UserName" runat="server"></asp:TextBox>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <asp:Label ID="PasswordLabel" runat="server" AssociatedControlID="Password">Password</asp:Label>
                            </td>
                            <td>
                                <asp:TextBox ID="Password" runat="server" TextMode="Password"></asp:TextBox>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2">
                                <asp:CheckBox ID="RememberMe" runat="server" Text=" Keep me signed in on this computer." />
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2" align="center">
                                <asp:Button runat="server" ID="ImageButton1" Text="Sign In" CausesValidation="true"
                                    Font-Bold="True" CommandName="Login" OnClientClick="return SignInValidate();">
                                </asp:Button>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2" style="color:Red;">
                                <asp:Literal ID="FailureText" runat="server" EnableViewState="False" ></asp:Literal>
                            </td>
                        </tr>
                    </table>
                </asp:Panel>
            </LayoutTemplate>
        </asp:Login>
    </div>
    </form>
</body>
</html>
